package com.lizhongbao.demo.provider;

import com.alibaba.fastjson.JSONObject;
import com.lizhongbao.demo.domain.dto.TestDto;
import com.lizhongbao.demo.domain.dto.TestQueryDto;
import com.lizhongbao.demo.domain.eo.Test;
import com.lizhongbao.demo.service.BizApi;
import com.lizhongbao.demo.service.BizService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * 测试 Provider
 *
 * @Author lizhongbao
 * @Date 2019/12/23 17:23
 **/
@RestController
public class BizProvider implements BizApi {

    private static Logger logger = LoggerFactory.getLogger(BizProvider.class);

    @Autowired
    private BizService bizService;

    @Override
    public JSONObject page(TestQueryDto dto, Long page, Long size) {
        return bizService.page(dto, page, size);
    }

    @Override
    public JSONObject list(TestQueryDto dto) {
        return bizService.list(dto);
    }

    @Override
    public Test detail(Long id) {
        return bizService.detail(id);
    }

    @Override
    public Boolean create(@Valid TestDto dto) {
        return bizService.create(dto);
    }

    @Override
    public Boolean update(Long id, @Valid TestDto dto) {
        return bizService.update(id, dto);
    }

    @Override
    public Boolean delete(Long id) {
        return bizService.delete(id);
    }

    @Override
    public Boolean delete(Long[] ids) {
        return bizService.delete(ids);
    }
}
